package com.kakarote.common.field.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.kakarote.core.common.enums.FieldEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * @author zhangzhiwei
 * 通用的自定义扩展明细表格字段对象
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@ApiModel("自定义字段明细表格对象")
public class ModelFieldExtend extends ModelFieldDetail {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("字段ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(exist = false)
    private Long fieldId;

    @ApiModelProperty("模块名称")
    @TableField(exist = false)
    private Integer label;

    @ApiModelProperty("对应主字段id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentFieldId;

    public ModelFieldExtend() {
    }

    public ModelFieldExtend(String fieldName, String name, FieldEnum fieldEnum) {
        super(fieldName, name, fieldEnum);
    }
}
